package utils;

import entity.Word;

public class WordUtil {

    public static boolean isVacuumOrBoundaryOrOperator(char ch){
        if (ch == ' ' || ch == '+' || ch == '-'
                || ch == '*' || ch == '/' || ch == '='
                || ch == ']' || ch == ';' || ch == ')'
                || ch == '.' || ch == '}' || ch == ','
                || ch == '%' || ch == '}' || ch == '!'
                || ch == '>' || ch == '<' || ch == '&'
                || ch == '|' || ch == ' ' || ch == '\n'
        ){
            return true;
        }else {
            return false;
        }
    }

    // 单词是否为标识符
    public static boolean isIdentifier(Word word){
        return word.getCode() == 1 ? true : false;
    }

    // 单词是否为整型常量
    public static boolean isIntegerConstant(Word word){
        return word.getCode() == 201 ? true : false;
    }

    // 单词是否为实数常量
    public static boolean isRealConstant(Word word){
        return word.getCode() == 202 ? true : false;
    }

    // 单词是否为字符常量
    public static boolean isCharacterConstant(Word word){
        return word.getCode() == 204 ? true : false;
    }


}
